<template>
  <div class="child">
    <h3>我是Child组件（子）</h3>
    {{sum}}
  </div>
</template>

<script>
export default {
  name: 'Child',
  // 由于组件的加载是异步的并且需要<Suspense>配合，所以setup可以接受Promise对象
  /* setup() {
    let sum = ref(0)
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve({sum})
      }, 1000)
    })
  } */

  async setup() {
    let p = new Promise((resolve, reject) => {
      setTimeout(() => {
        reslove({sum})
      }, 3000)
    })

    return await p 
  }
}
</script>

<style>
.child {
  padding: 10px;
  background-color: skyblue;
}
</style>